$(function () {
    var token = localStorage.getItem("jwt");
    var groupIndex = localStorage.getItem("groupIndex");
    var groupTopicDetail = JSON.parse(localStorage.getItem("groupTopicDetail"));
    var groupId = groupTopicDetail[groupIndex].groupId;
    $("#title").text(groupTopicDetail[groupIndex].topicName);
    $("#group").text(groupTopicDetail[groupIndex].groupName);
    $("#leader").text(groupTopicDetail[groupIndex].leader);
    $(".pdfFile").attr("data", groupTopicDetail[groupIndex].report);
    $(".pdfFile").attr("type", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");

    //设置小组的报告分
    $("#giveScore").click(function () {
        var score = {reportGrade: $("#grade").val()};
        console.log(score);
        $.ajax({
            url:"/group/"+groupId+"/grade/report",
            type:"PUT",
            headers: {"Authorization": "Bearer " + token},
            contentType: "application/json",
            data: JSON.stringify(score),
            success:function () {
                window.location.href = "/teacher/scoreHome";
            }
        });
    });
});